package com.dup.jxlh.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dup.jxlh.admin.entities.model.Organ;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigInteger;
import java.util.ArrayList;

@Mapper
public interface OrganMapper extends BaseMapper<Organ> {
    @Select("select * from organ where company_id = #{companyId}")
    ArrayList<Organ> getOrganList(@Param("companyId") BigInteger companyId);

    @Select("select * from organ where company_id = #{companyId} and name = #{name}")
    Organ getOrganByName(@Param("companyId") BigInteger companyId,
                         @Param("name") String name);

    @Insert("insert into organ (company_id,name) values(#{companyId},#{name})")
    Integer addOrgan(@Param("companyId") BigInteger companyId,
                     @Param("name") String name);
}
